import fetch from 'common/src/utils/fetch'
let apiPrefix = '/api/studentservice/';

// 选题规则查询列表
export function electionRulesSettingList(data = {}) {
    return fetch({
        url: apiPrefix + 'electionSetting/electionRulesSettingList',
        method: 'post',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}

// 选题规则新增
export function insertRulesSetting(data = {}) {
    return fetch({
        url: apiPrefix + 'electionSetting/insertRulesSetting',
        method: 'post',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}
//选题规则删除
export function deleteRulesSetting(data = []) {
    return fetch({
        url: apiPrefix + 'electionSetting/deleteRulesSetting',
        method: 'delete',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}

//选题规则修改
export function updateRulesSetting(data = {}) {
    return fetch({
        url: apiPrefix + 'electionSetting/updateRulesSetting',
        method: 'post',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}

// 选题规则获取详情
export function rulesSettingDetail(data = {}) {
    return fetch({
        url: apiPrefix + `electionSetting/rulesSettingDetail`,
        method: 'post',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}

// 选题时间查询列表
export function electionTimeSettingList(data = {}) {
    return fetch({
        url: apiPrefix + 'electionSetting/electionTimeSettingList',
        method: 'post',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}

// 查询寻提规则名称集合
export function electionRulesSettingAllList(data = {}) {
    return fetch({
        url: apiPrefix + 'electionSetting/electionRulesSettingAllList',
        method: 'post',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}

// 选题时间规则新增
export function insertTimeSetting(data = {}) {
    return fetch({
        url: apiPrefix + 'electionSetting/insertTimeSetting',
        method: 'post',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}
//选题时间规则删除
export function deleteTimeSetting(data = []) {
    return fetch({
        url: apiPrefix + 'electionSetting/deleteTimeSetting',
        method: 'delete',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}

//选题时间规则修改
export function updateTimeSetting(data = {}) {
    return fetch({
        url: apiPrefix + 'electionSetting/updateTimeSetting',
        method: 'post',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}

// 选题时间规则获取详情
export function timeSettingDetail(data = {}) {
    return fetch({
        url: apiPrefix + `electionSetting/timeSettingDetail?id=${data.id}`,
        method: 'get',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}

// 选题批次查询列表
export function requireTopicBatchList(data = {}) {
    return fetch({
        url: apiPrefix + 'requireTopic/requireTopicBatchList',
        method: 'post',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}

// 选题批次新增
export function insertRequireTopicBatch(data = {}) {
    return fetch({
        url: apiPrefix + 'requireTopic/insertRequireTopicBatch',
        method: 'post',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}
//选题批次删除
export function deleteRequireTopicBatch(data = []) {
    return fetch({
        url: apiPrefix + 'requireTopic/deleteRequireTopicBatch',
        method: 'delete',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}

//选题批次修改
export function updateRequireTopicBatch(data = {}) {
    return fetch({
        url: apiPrefix + 'requireTopic/updateRequireTopicBatch',
        method: 'post',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}

// 选题批次获取详情
export function requireTopicBatchDetail(id) {
    return fetch({
        url: apiPrefix + `requireTopic/requireTopicBatchDetail?topicBatchId=`+id,
        method: 'get',
        headers: { 'Content-Type': 'application/json' },
    })
}


// 选题画像/成绩录入查询列表
export function requirePaperList(data = {}) {
    return fetch({
        url: apiPrefix + 'requirePaper/requirePaperList',
        method: 'post',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}

// 选题画像/成绩新增
export function insertRequirePaper(data = {}) {
    return fetch({
        url: apiPrefix + 'requirePaper/insertRequirePaper',
        method: 'post',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}
//选题画像/成绩删除
export function deleteRequirePaper(data = []) {
    return fetch({
        url: apiPrefix + 'requirePaper/deleteRequirePaper',
        method: 'delete',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}

//成绩保存
export function batcchRelease(data = {}) {
    return fetch({
        url: apiPrefix + 'requirePaper/topicBatch/release',
        method: 'post',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}
 

//成绩保存
export function updateRequireScore(data = {}) {
    return fetch({
        url: apiPrefix + 'requirePaper/updateRequireScore',
        method: 'post',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}

//选题成绩批量发布
export function sendRequireScoreStatus(calendarId, val, faculty) {
    return fetch({
        url: apiPrefix + 'requirePaper/sendRequireScoreStatus?calendarId='+calendarId+'&trainingLevel='+val+'&faculty='+faculty,
        method: 'get',
        headers: { 'Content-Type': 'application/json' }
    })
}

// 统计硕士/博士成绩占比
export function requireScoreData(data = {}) {
    return fetch({
        url: apiPrefix + 'requirePaper/requireScoreData',
        method: 'post',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}

// 选题画像/成绩获取详情
export function requirePaperDetail(data = {}) {
    return fetch({
        url: apiPrefix + 'requirePaper/requirePaperDetail',
        method: 'post',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}

// 查询选题批次维护-添加学生/未添加学生
export function requirePaperStudentList(data = {}) {
    return fetch({
        url: apiPrefix + 'requirePaper/requirePaperStudentList',
        method: 'post',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}
/*获取批次名单列表*/
export function findBatchNameList(data = {}) {
    return fetch({
        url: apiPrefix + 'requireTopic/findBatchNameList',
        method: 'post',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}

// 查询选题批次维护-添加学生/刪除学生
export function updatePaperStudent(data = {}) {
    return fetch({
        url: apiPrefix + 'requirePaper/updatePaperStudent',
        method: 'post',
        headers: { 'Content-Type': 'application/json' },
        data
    })
}

// 选题画像/成绩录入导出
export function exportRequirePaperList(data = {}) {
    return fetch({
        url: apiPrefix + 'requirePaper/exportRequirePaperList',
        method: 'post',
        headers: { 'Content-Type': 'application/json' },
        responseType: 'blob',
        data
    })
}

export default {
  electionRulesSettingList,
  insertRulesSetting,
  deleteRulesSetting,
  updateRulesSetting,
  rulesSettingDetail,
  electionTimeSettingList,
  electionRulesSettingAllList,
  insertTimeSetting,
  deleteTimeSetting,
  updateTimeSetting,
  timeSettingDetail,
  requireTopicBatchList,
  insertRequireTopicBatch,
  deleteRequireTopicBatch,
  updateRequireTopicBatch,
  requireTopicBatchDetail,
  requirePaperList,
  insertRequirePaper,
  deleteRequirePaper,
  batcchRelease,
  updateRequireScore,
  requireScoreData,
  sendRequireScoreStatus,
  requirePaperDetail,
  requirePaperStudentList,
  findBatchNameList,
  updatePaperStudent,
  exportRequirePaperList
}
